package com.rongke.enums;

/**
 * Created by bilibili on 2017/9/20.
 */
public enum CouponEnum {
    COUPONNUM1(1,"无门槛优惠10元"),COUPONNUM2(2,"满199送20元"),COUPONNUM3(3,"满299送30元"),COUPONNUM4(4,"满399送40元");

    private Integer type;
    private String typeName;
    CouponEnum(Integer type, String typeName) {
        this.type = type;
        this.typeName = typeName;
    }


    /**
     * 根据type 获取typeName
     * @param type
     * @return
     */
    public static CouponEnum getCouponEnumByType(Integer type) {
        for (CouponEnum couponEnum: values()) {
            if (couponEnum.getType().equals(type)) {
                return couponEnum;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }


}
